﻿#ifndef PST_DATACLIPPERGENERATOR_H
#define PST_DATACLIPPERGENERATOR_H

#include <QObject>
#include <vtkSmartPointer.h>

class vtkPlane;
class vtkActor;
class vtkDataSet;
class vtkLookupTable;
class vtkClipPolyData;
class vtkPolyDataMapper;
class vtkDataSetSurfaceFilter;

namespace pst
{
    class DataClipperGenerator : public QObject
    {
        Q_OBJECT
    public:
        DataClipperGenerator(QObject* parent);
        ~DataClipperGenerator();

    public:
        void setInputData(vtkDataSet* inputDatas);
        vtkDataSet* getOutputData();

        //法向方向 0:X  1:Y  2:Z
        void setPlaneNormalDirection(double x, double y, double z);
        double* getPlaneNormalDirection();

        void setPlaneOrigin(double posx, double posy, double posz);
        double* getPlaneOrigin();

        void setLookupTable(vtkLookupTable* lut);
        vtkLookupTable* getLookupTable();

        void update();

        vtkSmartPointer<vtkActor> getClipActor();

    private:
        void initPipeLine();

        double m_planeNormalDirection[3];
        double m_planeOrigin[3];

        vtkDataSet* m_dataSetList;
        vtkSmartPointer<vtkDataSetSurfaceFilter> m_surfaceFilter;
        vtkSmartPointer<vtkPlane> m_clipPlane;
        vtkSmartPointer<vtkClipPolyData> m_clipFilter;
        vtkSmartPointer<vtkPolyDataMapper> m_mapper;
        vtkSmartPointer<vtkActor> m_actor;
        vtkLookupTable* m_lookupTable;
    };

}
#endif
